﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace RiskMan.DataClass.Models
{
    [Serializable]
    public class Trade : INotifyPropertyChanged, ISerializable
    {
        
        private String _Account;
        private String _ClientCode;

        public String Account 
        {
            get { return _Account; }
            set 
            {
                if (_Account != value)
                {
                    _Account = value;
                    RaisePropertyChanged("Account");
                }
            }
        }

        public String ClientCode
        {
            get { return _ClientCode; }
            set 
            {
                if (_ClientCode != value)
                {
                    _ClientCode = value;
                    RaisePropertyChanged("ClientCode");
                }
            }
        }
        #region event PropertyChangedEventHandler

        public event PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion

        public Trade() { }

        protected Trade(SerializationInfo info, StreamingContext context)
        {
            Account = (string)info.GetValue("Account", typeof(string));
            ClientCode = (string)info.GetValue("ClientCode", typeof(string));
        }
        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("Account", _Account);
            info.AddValue("ClientCode", _ClientCode);
        }
    }
}
